/**
 *
 */
package jp.seraph.same.view.cui;

import jp.seraph.cui.AbstractCommand;
import jp.seraph.cui.InternalConsole;
import jp.seraph.cui.StringData;
import jp.seraph.cui.StringDataType;
import jp.seraph.cui.SystemNode;
import jp.seraph.cui.SystemNodeType;

/**
 *
 *
 */
public class CreateMotionCommand extends AbstractCommand {

    /**
     * @param aParent
     * @param aConsole
     */
    public CreateMotionCommand(MotionEditMode aParent, InternalConsole aConsole) {
        super(aParent, aConsole);
    }

    /**
     *
     * @see jp.seraph.cui.AbstractCommand#executeImpl(jp.seraph.cui.SystemNode[], int)
     */
    @Override
    protected void executeImpl(SystemNode[] aArgs, int aArgListIndex) {
        String tMotionName = ((StringData)aArgs[0]).getData();
        MotionEditMode tParent = (MotionEditMode)this.getParent();

        tParent.createMotion(tMotionName);
    }

    /**
     *
     * @see jp.seraph.cui.Command#getArgumentTypes()
     */
    public SystemNodeType[][] getArgumentTypes() {
        SystemNodeType[][] tResult = new SystemNodeType[1][];

        tResult[0] = new SystemNodeType[]{ StringDataType.getInstance() };

        return tResult;
    }

    /**
     *
     * @see jp.seraph.cui.Command#getHelp()
     */
    public String getHelp() {
        return "create \"MotionName\" :  : create a new Motion in a directory that has this command.";
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#getName()
     */
    public String getName() {
        return "create";
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#getType()
     */
    public SystemNodeType getType() {
        return CreateMotionCommandType.getInstance();
    }

    /**
     *
     * @see jp.seraph.cui.SystemNode#isRoot()
     */
    public boolean isRoot() {
        return false;
    }
}
